Attribute VB_Name = "MOpenClose"
''' VBA Code Documentor 5.0 by Rob Bovey, copyright 1996-2004,
''' all rights reserved. May be redistributed for free,
''' but may not be sold without the author's explicit permission.
Option Explicit
Option Private Module

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Comments:   This routine is run every time the application is opened.
'''             It handles initialization of the application.
'''
''' Date        Developer           Action
''' --------------------------------------------------------------------------
''' 01/11/00    Rob Bovey           Created
''' 06/09/04    Rob Bovey           Updated coding conventions.
'''
Public Sub Auto_Open()

    Dim lCount As Long
    Dim ctlToolsMenu As Office.CommandBarPopup
    Dim ctlAppMenu As Office.CommandBarButton
    
    ''' Adds a menu item to the Tools menu on the Worksheet and Chart menu bars.
    For lCount = 1 To 2
        Set ctlToolsMenu = Application.CommandBars(lCount).FindControl(, 30007)
        Set ctlAppMenu = ctlToolsMenu.Controls.Add(msoControlButton)
        ctlAppMenu.Caption = gszAPP_MENU
        ctlAppMenu.OnAction = ThisWorkbook.Name & gszBANG & "CodeDocumentorMain"
    Next lCount
    
End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Comments:   This routine is run every time the application is closed.
'''             It handles the orderly shutdown of the application.
'''
''' Date        Developer           Action
''' --------------------------------------------------------------------------
''' 01/11/00    Rob Bovey           Created
''' 06/09/04    Rob Bovey           Updated coding conventions.
'''
Public Sub Auto_Close()

    Dim lCount As Long
    Dim ctlToolsMenu As Office.CommandBarPopup
    
    On Error Resume Next
    
    ''' Removes the Code Documentor menu items.
    For lCount = 1 To 2
        Set ctlToolsMenu = Application.CommandBars(lCount).FindControl(, 30007)
        ctlToolsMenu.Controls(gszAPP_MENU).Delete
    Next lCount
    
End Sub

